<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var rg = /[abc]/;
        console.log(rg.test('andy'));
        console.log(rg.test('baby'));
        console.log(rg.test('cat'));
    
        var rg1 = /^[abc]$/;
        console.log(rg1.test('a'));
        console.log(rg1.test('b'));
        console.log(rg1.test('c'));
        console.log(rg1.test('ab'));
    </script>
</body>
</html>